package com.qire.other.advert;

/**
 * <p> 广告商 </p>
 * <pre>
 * {@link #UNKNOWN}     未知
 * {@link #PANGOLIN}    穿山甲
 * {@link #TENCENT}     腾讯联盟(广点通)
 * {@link #BAIDU}       百度联盟
 * {@link #GOOGLE}      谷歌广告
 * </pre>
 */
public enum Advertiser {

    /** 未知 */
    UNKNOWN(0,"UNKNOWN"),
    /** 穿山甲 */
    PANGOLIN(1,"PANGOLIN"),
    /** 腾讯联盟(广点通) */
    TENCENT(2,"TENCENT"),
    /** 百度联盟 */
    BAIDU(3,"BAIDU"),
    /** 谷歌广告 */
    GOOGLE(4,"GOOGLE");

    public final int id;
    public final String name;

    Advertiser(int id, String name){
        this.id = id;
        this.name = name;
    }

    /**
     * 通过广告商代码构建广告商类型
     * @param fac 广告商代码
     * @return
     */
    public static Advertiser build(String fac) {
        switch (fac){
            case "csj":
                return PANGOLIN;
            case "gdt":
                return TENCENT;
            case "baidu":
                return BAIDU;
            case "google":
                return GOOGLE;
        }
        return null;
    }

}
